
package com.nikmesoft.android.alwaysontime.activities;

import java.util.ArrayList;
import android.app.Activity;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;
import com.nikmesoft.android.alwaysontime.R;
import com.nikmesoft.android.alwaysontime.adapters.SmsSentAdapter;
import com.nikmesoft.android.alwaysontime.daos.SmsMainDAO;
import com.nikmesoft.android.alwaysontime.models.SmsMainItem;

public class SMSActivitySent extends BaseActivity
{
	ListView smsListView;
	SmsSentAdapter smsAdapter;
	ArrayList<SmsMainItem> smsList;
	SmsMainDAO smsDAO;
	
	static int SMS_OVER = 3;
	@Override
	public void onCreate(Bundle savedInstanceState)
	{	//super.onCreate(savedInstanceState);
		//setContentView(R.layout.activity_smsactivity_sent);
		super.onCreate(savedInstanceState);
		View viewToLoad = LayoutInflater.from(this.getParent()).inflate(R.layout.activity_smsactivity_sent, null);
		this.setContentView(viewToLoad);
		// setContentView(R.layout.activity_sms);
		init();
	}

	public void init()
	{	smsDAO = SmsMainDAO.getInstance();
		smsListView = (ListView) findViewById( R.id.smsSentListView);
		//list
		smsList = new ArrayList<SmsMainItem>();
		smsList = smsDAO.getSms(SMS_OVER);
		//adapter
		smsAdapter = new SmsSentAdapter(this, R.layout.sms_list_item_main, smsList);
		smsListView.setAdapter( smsAdapter);
		smsListView.setOnItemClickListener( new OnItemClickListener()
		{	public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3)
			{
							
			}
		});
	}
	
	@Override
	public boolean onCreateOptionsMenu(Menu menu)
	{	getMenuInflater().inflate(R.menu.activity_smsactivity_sent, menu);
		return true;
	}
}
